/**
 * The third type of container. It can load different types of goods until it is
 * full. It can only load frozen goods.
 * 
 * @author Xi
 * 
 */
public class Container3 extends Container {

	public Container3(int capacity) {
		super(capacity);
	}

	@Override
	public void load(Goods goods) {
		// check if the goods is frozen
		if (goods.getType().equals(GoodsType.Frozen)) {
			try {
				loadGoods(goods);
			} catch (TransportException e) {
				e.printStackTrace();
			}
		} else {
			System.out
					.println("The goods can not be loaded, because the goods is not frozen!");
		}
	}

	@Override
	public void unload() {
		if (!goodsList.isEmpty()) {
			// remove the goods from the container
			Goods removedGoods = goodsList.remove(0);
			weight -= removedGoods.getWeight(); // change the container weight
			System.out.println("The goods is removed, goods weight: "
					+ removedGoods.getWeight() + " , goods type: "
					+ removedGoods.getType() + " , goods value: "
					+ removedGoods.getValue());
		}
	}

}
